<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
<script src="../artDialog.source.js?skin=default"></script>
<script src="../plugins/iframeTools.source.js"></script>
</head>

<body style="margin:0">
<div style="width:400px; height:300px; padding:20px">
<div style="margin:4px 0; padding:5px; background:#EEF7F5; text-align:left; color:#000; border-radius:3px; border:1px solid #D7EAE2; " class="tips">我是iframe页面：<a href="iframeA.html" target="_blank">iframeA.html</a></div>
<input style="width:15em; padding:4px;" id="aInput" value="我是小A"> <button id="aButton">传递给B页面</button> <button id="exit">关闭并返回数据到主页面</button> <button id="reload">刷新主页面</button>
</div>
<script>
if (art.dialog.data('test')) {
	document.getElementById('aInput').value = art.dialog.data('test');// 获取由主页面传递过来的数据
};

// 传递给B页面
document.getElementById('aButton').onclick = function () {
	var aValue = document.getElementById('aInput').value;
	art.dialog.data('aValue', aValue);// 存储数据
	
	var path = art.dialog.data('homeDemoPath') || './';// 
	
	art.dialog.open(path + 'iframeB.html?fd', {
		id: 'AAA',
		close: function () {
			var bValue = art.dialog.data('bValue');// 读取B页面的数据
			if (bValue !== undefined) document.getElementById('aInput').value = bValue;
		}
	}, false);
};

// 关闭并返回数据到主页面
document.getElementById('exit').onclick = function () {
	var origin = artDialog.open.origin;
	var aValue = document.getElementById('aInput').value;
	var input = origin.document.getElementById('demoInput04-3');
	input.value = aValue;
	input.select();
	art.dialog.close();
};

// 刷新主页面
document.getElementById('reload').onclick = function () {
	art.dialog.data('iframeTools', '我知道你刷新了页面～哈哈'); // plugin.iframe.html可以收到
	var win = art.dialog.open.origin;//来源页面
	// 如果父页面重载或者关闭其子对话框全部会关闭
	win.location.reload();
	return false;
};
</script>
</body>
</html>
